home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / os2 / nftp082.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1996-08-13  |  7KB  |  212 lines

  1. /* REXX */
  2.  
  3. /* Load RexxUtil extensions */
  4. if RxFuncQuery("SysLoadFuncs") then do
  5.     say "loading RexxUtil extensions..."
  6.     call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  7.     if result \= "0" then do
  8.         say "error loading RexxUtil.dll"
  9.         exit
  10.     end
  11.     call SysLoadFuncs
  12. end
  13.  
  14. /* ask user about directories etc. */
  15. Call SysCls
  16. say
  17. say "NFTP Version 0.82 installation"
  18. say
  19. say "This script will do the following:"
  20. say "1) copy required files into the directory you specified;"
  21. say "2) set up default settings in nftp.ini"
  22. say "3) create two objects on your desktop:"
  23. say "   one for NFTP itself and another for its manual."
  24. say
  25.  
  26. numlangs = 13
  27. lang.1  = "English   "
  28. lang.2  = "Russian   "
  29. lang.3  = "Chinese   "
  30. lang.4  = "Spanish   "
  31. lang.5  = "Swedish   "
  32. lang.6  = "Hungarian "
  33. lang.7  = "German    "
  34. lang.8  = "Danish    "
  35. lang.9  = "Japanese  "
  36. lang.10 = "Norwegian "
  37. lang.11 = "Italian   "
  38. lang.12 = "Brazilian "
  39. lang.13 = "Dutch     "
  40. lang.14 = "          "
  41. lang.15 = "          "
  42.  
  43. choose_language:
  44.     
  45. say "Enter no. of language you wish to install:"
  46. do i = 1 to numlangs by 3
  47.     i1 = i + 1
  48.     i2 = i + 2
  49.     say right(i,2)")" lang.i "    " right(i1,2)")" lang.i1 "    " right(i2,2)")" lang.i2
  50. end
  51. say "Empty line entered will abort installation."
  52. parse pull langno .
  53. if langno = "" then exit
  54. if (langno > numlangs) | (langno < 1) then do
  55.     say "The number you entered is outside of range"
  56.     say
  57.     signal choose_language
  58. end
  59. language = lang.langno
  60.  
  61. say
  62. say "Enter destination directory (where NFTP files will be installed)."
  63. say "If you wish to install NFTP into the subtree (eg, ""d:\apps\tcpip\nftp"")"
  64. say "you have to create upper directory first (""d:\apps\tcpip"" in the"
  65. say "above example). Enter ""."" to install into the current directory."
  66. say "Empty line entered will abort installation."
  67. parse pull destpath .
  68. if destpath = "" then exit
  69.  
  70. say
  71. say "Enter default path for downloads (e.g., ""d:\tmp"")."
  72. say "This directory should reside on HPFS drive or you'll be unable"
  73. say "to download files which are not 8.3-compliant."
  74. parse pull dlpath .
  75.  
  76. say
  77. say "Enter your e-mail address (to be used as a password for anonymous logins):"
  78. parse pull email .
  79. if email = "" then exit
  80.  
  81. destpath = strip(destpath, "T", "\")
  82. dlpath = strip(dlpath, "T", "\")
  83.  
  84. /* verify choices */
  85. say
  86. say copies("-", 75)
  87. say "Installing NFTP into the directory :" destpath
  88. say "NFTP language                      :" language
  89. if dlpath <> "" then ,
  90.     say "Default download directory is      :" dlpath
  91. say "Your e-mail address                :" email
  92. say
  93. say "Press Ctrl-C to abort or any other key to continue"
  94. say
  95. '@pause >nul'
  96. say
  97.  
  98. /* creating target directories if necessary */
  99. if destpath <> "." then
  100. do
  101.     call SysFileTree destpath, "srch", "D"
  102.     if srch.0 = 0 then do
  103.         rc = SysMkDir(destpath)
  104.         if rc <> 0 then do
  105.             say "Fatal error: cannot create directory" destpath
  106.             exit
  107.         end
  108.     end
  109. end
  110.  
  111. if (dlpath <> ".") & (dlpath <> "") then
  112. do
  113.     call SysFileTree dlpath, "srch", "D"
  114.     if srch.0 = 0 then do
  115.         rc = SysMkDir(dlpath)
  116.         if rc <> 0 then do
  117.             say "Fatal error: cannot create directory" dlpath
  118.             exit
  119.         end
  120.     end
  121. end
  122.     
  123. /* copying NFTP files */
  124. if destpath <> "." then
  125. do
  126.     '@copy nftp.exe'     destpath'\nftp.exe     >nul'
  127.     '@copy nftp.ico'     destpath'\nftp.ico     >nul'
  128.     '@copy nftp-opt.exe' destpath'\nftp-opt.exe >nul'
  129.     '@copy keynames.exe' destpath'\keynames.exe >nul'
  130.     '@copy nftp-man.htm' destpath'\nftp-man.htm >nul'
  131.     '@copy nftp-man.ps'  destpath'\nftp-man.ps  >nul'
  132.     '@copy nftp-man.txt' destpath'\nftp-man.txt >nul'
  133.     '@copy nftp-man.ico' destpath'\nftp-man.ico >nul'
  134.     '@copy english.dll'  destpath'\ >nul'
  135.     '@copy 'strip(left(language,7))'.dll'  destpath'\ >nul'
  136.     say "Files were copied to" destpath
  137. end
  138.  
  139. if destpath = "." then destpath = directory()
  140. if dlpath = "." then dlpath = directory()
  141.     
  142. /* making sure we will not overwrite existing nftp.mrk */
  143. if stream(destpath"\nftp.mrk", "C", "QUERY EXISTS") == "" then
  144.     '@copy nftp.m 'destpath'\nftp.mrk >nul'
  145.  
  146. /* checking 'nftp.ini' presence */
  147. newinifile = destpath"\nftp.ini"
  148. if stream(destpath"\nftp.ini", "C", "QUERY EXISTS") <> "" then 
  149. do
  150.     say destpath"\nftp.ini already exists."
  151.     say "File ""nftp.new"" will be created in the" destpath
  152.     say "Please examine it and add new options to your"
  153.     say "existing configuration file"
  154.     newinifile = destpath"\nftp.new"
  155. end
  156. call SysFileDelete newinifile
  157.  
  158. /* creating new 'nftp.ini' and customizing it slightly */
  159. signal off notready
  160. do forever
  161.     lin = linein("nftp.i")
  162.     newlin = lin
  163.     if left(lin,1) <> ";" then
  164.     do
  165.         if substr(lin,1,19) = 'anonymous-password=' then
  166.             newlin = 'anonymous-password="'email'"'
  167.         if substr(lin,1,19) = 'log-transfers-name=' then
  168.             newlin = 'log-transfers-name="'destpath'\nftp.fls"'
  169.         if substr(lin,1,22) = 'default-download-path=' then
  170.             newlin = 'default-download-path="'dlpath'"'
  171.         if substr(lin,1,15) = 'bookmarks-file=' then
  172.             newlin = 'bookmarks-file="'destpath'\nftp.mrk"'
  173.     end
  174.     rc = lineout(newinifile, newlin)
  175.     if lin = "" & left(stream("nftp.i"),5) <> "READY" then leave
  176. end
  177. call stream "nftp.i", "C", "CLOSE"
  178. call stream newinifile, "C", "CLOSE"
  179.  
  180. /* creating nftp.cmd */
  181.  
  182. cmdfile = destpath"\nftp.cmd"
  183. rc = lineout(cmdfile, "@set NFTP_LANG="strip(left(language,7)))
  184. rc = lineout(cmdfile, "@"destpath"\nftp.exe %1 %2 %3 %4 %5 %6")
  185. call stream cmdfile, "C", "CLOSE"
  186.  
  187. /* creating WPS objects */
  188. say
  189. settings = 'EXENAME='destpath'\nftp.cmd;STARTUPDIR='dlpath';PARAMETERS=[FTP server to log in?];PROGTYPE=WINDOWABLEVIO;NOAUTOCLOSE=YES;MINIMIZED=NO;ICONFILE=nftp.ico'
  190. rc = SysCreateObject('WPProgram', 'NFTP', '<WP_DESKTOP>', settings, 'replace')
  191. if rc != 1 then say "Cannot create program object"
  192. else            say "Program       object was created"
  193.  
  194. settings = 'EXENAME=explore.exe;PARAMETERS=-q 'destpath'\nftp-man.htm;PROGTYPE=PM;MINIMIZED=NO;ICONFILE=nftp-man.ico'
  195. rc = SysCreateObject('WPProgram', 'NFTP manual', '<WP_DESKTOP>', settings, 'replace')
  196. if rc != 1 then say "Cannot create documentation object"
  197. else            say "Documentation object was created"
  198.  
  199. /* looks like we're done... */
  200. say
  201. say "Installation complete."
  202. say "You can customize "destpath"\nftp.ini according your preferences."
  203. say
  204. say "If you don't have EMX runtime support installed, copy emx.dll into"
  205. say "any directory specified in your LIBPATH. File 'emx.dll' provided"
  206. say "with NFTP version 0.82 has version number ""0.9b, fixlevel 5""."
  207. say "Read NFTP documentation about obtaining complete EMX runtime support"
  208. say "package and its source code."
  209. say
  210. '@pause'
  211. Exit
  212.